package com.qa.controller;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class test {
	public static void main(String[] args) throws ParseException {
		SimpleDateFormat myFmt = new SimpleDateFormat("yyyy-MM-dd");
		String beginTime = "2018-12-31";
		Date date = myFmt.parse(beginTime);
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		int beginYear = calendar.get(Calendar.YEAR);
		int begintian = calendar.get(Calendar.DAY_OF_YEAR);
		calendar.set(beginYear, 0, 1);
		int firstDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
		int firstday = calendar.get(Calendar.DAY_OF_YEAR);
		double d1 = begintian - firstday + firstDayOfWeek;
		int result = (int) Math.ceil(d1 / 7);
		System.out.println(result);
	}
}
